Ext.define('PJ.view.examinationManagement.ViewSignupStatusFrameButton', {
    extend: 'AM.default.DefaultWindowForm',
    requires: ['AM.default.DefaultDateField', 
               'AM.default.DateTime', 
               'AM.default.jsonp.DefaultSubmitJsonp',
               'PJ.view.examinationManagement.ViewSignupStatusListButton'
               ],
    
    modal: true,// 开启不允许点击其他组件
    frame: true,
    notEdit: true,
    width: 1055,
    height: 625,
    isSame: false,
    isEdit: null,

    initComponent: function(){
    	var me = this;
    	
    	me.items= [{
    		xtype: "fieldset",
    		layout: 'column',
            collapsible: false, //显示三角
            defaults: {
    			xtype: 'textfield',
            	labelAlign: 'right',
            	labelWidth: 65,
            	readOnly: true,
            	fieldCls: 'noBorder',
            	columnWidth: .5
            },
    		items: [{
    			fieldLabel: '班级名称',
    			name: 'className',
    			value:me.className,
            	columnWidth: 1
    		}, {
    			fieldLabel: '举办时间',
            	columnWidth: 1,
            	value:me.beginDate + ' 至 ' + me.endDate,
    			name: 'learnTime'
    		}]
    	}, {
    		xtype: "fieldset",
    		layout: 'column',
            collapsible: false, //显示三角
            height:475,
    		items: [{
    			xtype: 'viewManagementListButton',
            	columnWidth: 1,
            	grid:me,
            	classId:me.classId,
            	lockState:false,
            	clickSource:me.clickSource,
            	height:450
    		}]
    	}];
        me.buttons = [{
            text: '关闭',
            scope: this,
            handler: this.beforeclose,
            listeners: {
            	click: function(button){
            		this.up('window').close();
            	}
        }
        }];
        me.callParent(arguments);
    },

    listeners: {
    	beforeclose: function(button){
    		var me=this;
    		if(me.down('viewManagementListButton').getStore().getAt(0).get('lockState')==2){
    			Ext.MessageBox.buttonText.yes = '去锁定';
    			Ext.MessageBox.buttonText.no = '直接退出';
    			Ext.Msg.confirm('系统提示','培训班尚未锁定，只有锁定后考核结果才能生效。',function(btn){
			        if(btn=='yes'){
			          return;
			        }else{
		    			me.grid.store.reload();
			        	me.destroy();
			        }
    				return;
			      });
				return false;
    		}else{
    			me.grid.store.reload();
    		}
    	}
    }
});
